package com.lanxiao.cloud.modules.user.application.query;

import com.lanxiao.cloud.common.core.enums.SexEnum;
import com.lanxiao.cloud.common.core.enums.StateEnum;
import com.lanxiao.cloud.modules.user.application.dto.UserDeptQuery;
import com.lanxiao.cloud.modules.user.application.dto.UserQuery;
import java.util.List;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * @author ：qiaoliang
 * @date ：2021-09-14
 */
public class UserLambdaQuery {
  private final String name;
  private final String phone;
  private final SexEnum sex;
  private final List<Long> deptIds;
  private final StateEnum state;

  public static UserLambdaQuery toUserName(String name){
    return new UserLambdaQuery(name, null, null, null, null);
  }

  public static UserLambdaQuery toUserLambdaQuery(UserQuery query) {
    return UserLambdaQueryConverter.INSTANCE.toUserLambdaQuery(query);
  }

  public static UserLambdaQuery toUserLambdaQuery(UserDeptQuery query) {
    return UserLambdaQueryConverter.INSTANCE.toUserLambdaQuery(query);
  }

  @Mapper
  public interface UserLambdaQueryConverter {
    UserLambdaQueryConverter INSTANCE = Mappers.getMapper(UserLambdaQueryConverter.class);

    UserLambdaQuery toUserLambdaQuery(UserQuery query);
    UserLambdaQuery toUserLambdaQuery(UserDeptQuery query);

  }

  public UserLambdaQuery(String name, String phone, SexEnum sex,
      List<Long> deptIds, StateEnum state) {
    this.name = name;
    this.phone = phone;
    this.sex = sex;
    this.deptIds = deptIds;
    this.state = state;
  }

  public String getName() {
    return name;
  }

  public String getPhone() {
    return phone;
  }

  public SexEnum getSex() {
    return sex;
  }

  public List<Long> getDeptIds() {
    return deptIds;
  }

  public StateEnum getState() {
    return state;
  }


}
